package com.example.demo.entity.response;


import com.example.demo.ResBean.constant.ResCode;

import java.io.Serializable;

public class Response implements Serializable {
    private int code;
    private String message;
    private Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Response() {
    }

    public Response(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Response success(String message, Object data) {
        return new Response(ResCode.Success, message, data);
    }

    public static Response success(String message) {
        return success(message, null);
    }

    public static Response success(Object data) {
        return success(ResCode.Success_str, data);
    }

    public static Response success() {
        return success(ResCode.Success_str);
    }

    public static Response success(int code, String message, Object data) {
        return new Response(code, message, data);
    }


    public static Response success(int code, String message) {
        return new Response(code, message, null);
    }

    public static Response error(int code, String message, Object data) {
        return new Response(code, message, data);
    }

    public static Response error(int code, String message) {
        return new Response(code, message, null);
    }

    public static Response error() {
        return new Response(ResCode.User_NO_Find, ResCode.User_NO_Find_str, null);
    }

    public static Response error(String message) {
        return error(message, null);
    }

    public static Response error(String message,Object data) {
        return new Response(ResCode.
                Error,message, data);
    }
}
